﻿@{
    ViewData["Title"] = "登录";
    Layout = null; // 登录页独立，不使用全局布局
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewData["Title"]</title>
    <!-- 引入Bootstrap样式（可选，用于美化） -->
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
</head>
<body>
    <div class="container mt-5">
        <div class="row justify-content-center">
            <div class="col-md-4">
                <div class="card">
                    <div class="card-header">
                        <h3>仓储管理系统-登录</h3>
                    </div>
                    <div class="card-body">
                        <!-- 显示登录错误信息（若有） -->
                        @if (ViewBag.ErrorMessage != null)
                        {
                            <div class="alert alert-danger" role="alert">
                                @ViewBag.ErrorMessage
                            </div>
                        }

                        <!-- 登录表单：提交到LoginController的POST Login方法 -->
                        <form method="post" asp-controller="Login" asp-action="Login">
                            @Html.AntiForgeryToken() <!-- 配合[ValidateAntiForgeryToken]防CSRF -->

                            <div class="mb-3">
                                <label for="username" class="form-label">用户名</label>
                                <input type="text" class="form-control" id="username" name="username" required />
                            </div>
                            <div class="mb-3">
                                <label for="password" class="form-label">密码</label>
                                <input type="password" class="form-control" id="password" name="password" required />
                            </div>
                            <button type="submit" class="btn btn-primary">登录</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>